﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:gd="clr-namespace:WickedFlame.GenDock">
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/VecDraw.GenDock;component/Resources/Brushes.xaml"/>
        <ResourceDictionary Source="/VecDraw.GenDock;component/Resources/Common.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!--DockedWindow-->
    <Style TargetType="{x:Type gd:DockableWindow}">
        <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.ContentBackgroundBrush}}}"/>
        <!--DefaultBackgroundBrush-->
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="WindowStyle" Value="None" />
        <Setter Property="ShowInTaskbar" Value="False" />
        <Setter Property="ShowActivated" Value="False" />
        <Setter Property="SizeToContent" Value="WidthAndHeight" />
        <Setter Property="ResizeMode" Value="NoResize" />
        <Setter Property="AllowsTransparency" Value="true" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type gd:DockableWindow}">
                    <Border BorderBrush="Black" 
                            BorderThickness="1"
                            CornerRadius="3,3,0,0" 
                            Background="{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.ContentBackgroundBrush}}}"
                            Name="windowBorder">
                        <Grid
                            Background="{TemplateBinding Background}">
                            
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition/>
                            </Grid.RowDefinitions>

                            <Grid x:Name="dragableHeader" Grid.Row="0">
                                
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                
                                <Border Name="dockedHeaderDark" 
                                        Grid.Row="0" Focusable="False" 
                                        Background="{StaticResource PaneHeaderDarkBrush}"
                                        BorderThickness="1,1,1,0" 
                                        BorderBrush="{StaticResource PaneHeaderDarkBrush}"
                                        Height="3" >
                                    <!--{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.PaneHeaderDarkBrush}}}-->
                                </Border>

                                <Border Name="undockedHeaderDark" 
                                        Grid.Row="1"
                                        Focusable="False" 
                                        Background="{StaticResource PaneHeaderDarkGradientBrush}"
                                        BorderThickness="0,0,0,0" 
                                        BorderBrush="{StaticResource PaneHeaderDarkBrush}"
                                        Height="10" >
                                    <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" LastChildFill="True">
                                        
                                        <!--{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.PaneHeaderDarkBrush}}}-->
                                        <Button x:Name="btnPinClose" DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" Width="10" Height="10" Style="{StaticResource PaneHeaderCommandStyle}" 
                                            Command="gd:DockableWindow.CloseCommand">
                                            <Viewbox Width="10" Height="10" HorizontalAlignment="Center" VerticalAlignment="Center">
                                                <Image Source="Images\PinClose.png" Stretch="None" SnapsToDevicePixels="True"/>
                                            </Viewbox>
                                        </Button>
                                        <Separator  DockPanel.Dock="Right" BorderThickness="1" BorderBrush="White"/><!---->
                                        <Border BorderBrush="Transparent" Background="Transparent" DockPanel.Dock="Right"/>
                                    </DockPanel>
                                </Border>

                                <Border 
                                    Grid.Row="2" Focusable="False" 
                                    Background="{StaticResource PaneHeaderLightGradientBrush}"
                                    BorderThickness="0,0,0,1" 
                                    BorderBrush="Black"
                                    Height="16"><!--Focusable="True"-->
                                    <!--AnchorBackgroundBrush;13;{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.PaneHeaderLightBrush}}}-->

                                    <DockPanel LastChildFill="True" HorizontalAlignment="Stretch">
                                        <Button x:Name="btnPinAutoHide" Visibility="Visible" DockPanel.Dock="Right" VerticalAlignment="Center" Width="10" Height="10" Style="{StaticResource PaneHeaderCommandStyle}" 
                                            Command="gd:DockableWindow.HideCommand" Margin="0,0,2,0">
                                            <Viewbox Width="10" Height="10">
                                                <Image Source="Images\PinArrowRightDark.png" Stretch="None" SnapsToDevicePixels="True"/>
                                            </Viewbox>
                                        </Button>

                                        <Button x:Name="btnPinCollapse" DockPanel.Dock="Right" VerticalAlignment="Center" Width="10" Height="10" Style="{StaticResource PaneHeaderCommandStyle}" 
                                            Command="gd:DockableWindow.CollapseCommand" Margin="0,0,2,0">
                                            <Viewbox Width="10" Height="10">
                                                <Image Source="Images\PinArrowUpDark.png" Stretch="None" Name="pinCollapseImage" SnapsToDevicePixels="True"/>
                                            </Viewbox>
                                        </Button>

                                        <Viewbox HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4,0,0,0">
                                            <ContentControl Foreground="{StaticResource PaneHeaderDarkBrush}" FontWeight="Bold">
                                                <!--WhiteSmoke;-->
                                                <ContentPresenter
													ContentSource="Title"
													SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                            </ContentControl>
                                        </Viewbox>

                                    </DockPanel>

                                </Border>
                            </Grid>

                            <ContentPresenter Grid.Row="1" Name="mainContent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                            
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>

                        <Trigger Property ="IsDocked" Value="true">
                            <!--<Setter Property="Visibility" Value="Collapsed" TargetName="btnPinClose"/>-->
                            <Setter Property="Visibility" Value="Visible" TargetName="dockedHeaderDark"/>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="undockedHeaderDark"/>
                            <Setter Property="Visibility" Value="Visible" TargetName="btnPinAutoHide"/>
                            <Setter Property="CornerRadius" Value="0" TargetName="windowBorder" />
                        </Trigger>

                        <Trigger Property ="IsDocked" Value="false">
                            <!--<Setter Property="Visibility" Value="Visible" TargetName="btnPinClose"/>-->
                            <Setter Property="Visibility" Value="Collapsed" TargetName="dockedHeaderDark"/>
                            <Setter Property="Visibility" Value="Visible" TargetName="undockedHeaderDark"/>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="btnPinAutoHide"/>
                            <Setter Property="CornerRadius" Value="3,3,0,0" TargetName="windowBorder" />
                        </Trigger>
                        
                        <Trigger Property ="IsCollapsed" Value="true">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="mainContent"/>
                            <Setter Property="Source" Value="Images\PinArrowDownDark.png" TargetName="pinCollapseImage"/>
                        </Trigger>
                        
                        <!--<Trigger Property="IsMouseOver" Value="false">
                            <Setter Property="Opacity" Value="0.7"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Opacity" Value="1"/>
                        </Trigger>-->
                        <Trigger Property="IsTranslucent" Value="true">
                            <Setter Property="Opacity" Value="0.7"/>
                        </Trigger>
                        <Trigger Property="IsTranslucent" Value="false">
                            <Setter Property="Opacity" Value="1"/>
                        </Trigger>

                        <!--<Trigger Property="IsMouseOver" Value="True">

                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity"
                  To="1" Duration="0:0:001" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity"
                  To="0.7" Duration="0:0:001" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>-->
                    
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>